home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_300 / 333_02 / p024.awk < prev    next >
Text File  |  1989-04-21  |  384b  |  17 lines

  1.  
  2. #   print countries with column headers and totals
  3.  
  4. BEGIN        {
  5.         FS = "\t"        # make tab the field separator
  6.         printf("%10s %6s %5s   %s\n\n",        \
  7.                "COUNTRY", "AREA", "POP", "CONTINENT")
  8.         }
  9.  
  10.         {
  11.         printf("%10s %6d %5d   %s\n", $1, $2, $3, $4)
  12.         area = area + $2
  13.         pop  = pop  + $3
  14.         }
  15.  
  16. END        { printf("\n%10s %6d %5d\n", "TOTAL", area, pop) }
  17.